<?php

/* @var $factory \Illuminate\Database\Eloquent\Factory */

use App\Post;
use Faker\Generator as Faker;

$factory->define(Post::class, function (Faker $faker) {
  /*  return [
        'title' => $faker->title,
        'content' => $faker->paragraph,
        'user_id' => function () {
            return factory(App\User::class)->create()->id;
        },

    ];*/
    return [
        'title' => $faker->name,
        'content' => $faker->paragraph,
        'user_id' => function () {
            return factory(App\User::class)->create()->id;
        },
        'created_at' => $faker->dateTimeBetween('-3 year', '-1 year'),// 时间在 三年到一年 之间
        'updated_at' => $faker->dateTimeBetween('-1 year', '-5 month'),// 时间在 一年到五个月之间

    ];
});
